//
//  KDPatientAppliTableViewCell.m
//  LaiKeDaoClient
//
//  Created by dongkedi的iMac on 15/11/25.
//  Copyright © 2015年 LKD. All rights reserved.
//

#import "KDPatientAppliTableViewCell.h"
#import "UIImageView+WebCache.h"

@implementation KDPatientAppliTableViewCell
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createUI];
    }
    return self;
}

- (void)createUI
{
    self.headImageView = [[UIImageView alloc] initWithFrame:(CGRect){10,5,44,44}];
    [self.headImageView setImage:[UIImage imageNamed:@"ic_pic.png"]];
    self.headImageView.layer.cornerRadius = 5;
    self.headImageView.layer.masksToBounds = YES;
    [self.contentView addSubview:_headImageView];
    
    self.nameLabel = [[UILabel alloc] initWithFrame:(CGRect){X(_headImageView)+WIDTH(_headImageView)+10,Y(_headImageView),200,20}];
    [_nameLabel setTextAlignment:NSTextAlignmentLeft];
    [_nameLabel setFont:[UIFont systemFontOfSize:16]];
    [_nameLabel setBackgroundColor:[UIColor clearColor]];
    [_nameLabel setText:@"姓名"];
    [self.contentView addSubview:_nameLabel];
    
    self.timeLabel = [[UILabel alloc] initWithFrame:(CGRect){kScreenWidth-110,Y(_headImageView),100,20}];
    [_timeLabel setTextAlignment:NSTextAlignmentRight];
    [_timeLabel setFont:[UIFont systemFontOfSize:12]];
    [_timeLabel setBackgroundColor:[UIColor clearColor]];
    [_timeLabel setTextColor:[UIColor colorWithHexString:@"cccccc"]];
    [_timeLabel setText:@"10:01"];
    [self.contentView addSubview:_timeLabel];
    
    self.addLabel = [[UILabel alloc] initWithFrame:(CGRect){kScreenWidth-60,28,50,20}];
    [_addLabel setTextAlignment:NSTextAlignmentRight];
    [_addLabel setFont:[UIFont systemFontOfSize:12]];
    [_addLabel setBackgroundColor:[UIColor clearColor]];
    [_addLabel setTextColor:[UIColor colorWithHexString:@"cccccc"]];
    [_addLabel setText:@"未添加"];
    [self.contentView addSubview:_addLabel];
    
    UILabel     *label1= [[UILabel alloc] initWithFrame:(CGRect){X(_nameLabel),Y(_addLabel),30,20}];
    [label1 setTextAlignment:NSTextAlignmentLeft];
    [label1 setFont:[UIFont systemFontOfSize:12]];
    [label1 setBackgroundColor:[UIColor clearColor]];
    [label1 setText:@"申请"];
    [label1 setTextColor:[UIColor colorWithHexString:@"cccccc"]];
    [self.contentView addSubview:label1];
    
    self.time2Label = [[UILabel alloc] initWithFrame:(CGRect){X(label1)+WIDTH(label1),Y(label1),100,20}];
    [_time2Label setTextAlignment:NSTextAlignmentCenter];
    [_time2Label setFont:[UIFont systemFontOfSize:12]];
    [_time2Label setBackgroundColor:[UIColor colorWithHexString:@"3caa00"]];
    [_time2Label setTextColor:[UIColor whiteColor]];
    [_time2Label setText:@"2015.00.00 上午"];
    _time2Label.layer.cornerRadius = 5;//设置那个圆角的有多圆
    _time2Label.layer.masksToBounds = YES;
    [self.contentView addSubview:_time2Label];
}


- (void)reloadData:(NSDictionary    *)dataDic
{
    self.timeLabel.text = dataDic[@"creat_time"];
    self.time2Label.text = dataDic[@"check_time"];
    self.nameLabel.text = dataDic[@"patient_name"];
    if ([dataDic[@"is_pass"] intValue] == 0) {
        self.addLabel.text = @"未操作";
        [_addLabel setTextColor:[UIColor colorWithHexString:@"cccccc"]];
    }else if ([dataDic[@"is_pass"] intValue] == 1){
        self.addLabel.text = @"通过审核";
        [_addLabel setTextColor:kNavBlueColor];
    }else if ([dataDic[@"is_pass"] intValue] == 2){
        self.addLabel.text = @"未通过审核";
        [_addLabel setTextColor:[UIColor colorWithHexString:@"666666"]];
    }else{
        self.addLabel.text = @"未操作";
        [_addLabel setTextColor:[UIColor colorWithHexString:@"cccccc"]];
    }
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
